package com.wlient.basic.designPattern.factory;

import com.wlient.basic.designPattern.factory.base.BandConfig;
import com.wlient.basic.designPattern.factory.base.BaseConfig;
import com.wlient.basic.designPattern.factory.base.SchoolConfig;
import com.wlient.basic.designPattern.factory.base.ShopConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Getter
@Component("ConfigQueryFactory")
public class ConfigQueryFactory {

    @Resource
    private BandConfig bandConfig;

    @Resource
    private SchoolConfig schoolConfig;

    @Resource
    private ShopConfig shopConfig;

    public BaseConfig of(Integer key){
        switch (key){
            case 1: return bandConfig;
            case 2: return shopConfig;
            case 3: return schoolConfig;
            default: return null;
        }
    }


}
